home *** CD-ROM | disk | FTP | other *** search
/ Openstep 4.2 (Developer) / Openstep Developer 4.2.iso / NextDeveloper / Source / GNU / uucp / Uucp.framework / uuconf.subproj / snams.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-09  |  3.3 KB  |  134 lines

  1. /* snams.c
  2.    Get all known system names.
  3.  
  4.    Copyright (C) 1992 Ian Lance Taylor
  5.  
  6.    This file is part of the Taylor UUCP uuconf library.
  7.  
  8.    This library is free software; you can redistribute it and/or
  9.    modify it under the terms of the GNU Library General Public License
  10.    as published by the Free Software Foundation; either version 2 of
  11.    the License, or (at your option) any later version.
  12.  
  13.    This library is distributed in the hope that it will be useful, but
  14.    WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.    Library General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU Library General Public
  19.    License along with this library; if not, write to the Free Software
  20.    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  21.  
  22.    The author of the program may be contacted at ian@airs.com or
  23.    c/o Cygnus Support, 48 Grove Street, Somerville, MA 02144.
  24.    */
  25.  
  26. #include "uucnfi.h"
  27.  
  28. #if USE_RCS_ID
  29. const char _uuconf_snams_rcsid[] = "$Id: snams.c,v 1.5 1995/06/21 19:24:07 ian Rel $";
  30. #endif
  31.  
  32. /* Get all known system names.  */
  33.  
  34. int
  35. uuconf_system_names (pglobal, ppzsystems, falias)
  36.      pointer pglobal;
  37.      char ***ppzsystems;
  38.      int falias;
  39. {
  40.   struct sglobal *qglobal = (struct sglobal *) pglobal;
  41.   char **pztaylor;
  42.   char **pzv2;
  43.   char **pzhdb;
  44.   int iret;
  45.  
  46.   *ppzsystems = NULL;
  47.   pztaylor = NULL;
  48.   pzv2 = NULL;
  49.   pzhdb = NULL;
  50.  
  51. #if HAVE_TAYLOR_CONFIG
  52.   iret = uuconf_taylor_system_names (pglobal, &pztaylor, falias);
  53.   if (iret != UUCONF_SUCCESS)
  54.     return iret;
  55. #endif
  56.  
  57. #if HAVE_V2_CONFIG
  58.   if (qglobal->qprocess->fv2)
  59.     {
  60.       iret = uuconf_v2_system_names (pglobal, &pzv2, falias);
  61.       if (iret != UUCONF_SUCCESS)
  62.     return iret;
  63.     }
  64. #endif
  65.  
  66. #if HAVE_HDB_CONFIG
  67.   if (qglobal->qprocess->fhdb)
  68.     {
  69.       iret = uuconf_hdb_system_names (pglobal, &pzhdb, falias);
  70.       if (iret != UUCONF_SUCCESS)
  71.     return iret;
  72.     }
  73. #endif
  74.  
  75.   if (pzv2 == NULL && pzhdb == NULL)
  76.     *ppzsystems = pztaylor;
  77.   else if (pztaylor == NULL && pzhdb == NULL)
  78.     *ppzsystems = pzv2;
  79.   else if (pztaylor == NULL && pzv2 == NULL)
  80.     *ppzsystems = pzhdb;
  81.   else
  82.     {
  83.       char **pz;
  84.  
  85.       iret = UUCONF_SUCCESS;
  86.  
  87.       if (pztaylor != NULL)
  88.     {
  89.       for (pz = pztaylor; *pz != NULL; pz++)
  90.         {
  91.           iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE,
  92.                       ppzsystems, (pointer) NULL);
  93.           if (iret != UUCONF_SUCCESS)
  94.         break;
  95.         }
  96.     }
  97.  
  98.       if (pzv2 != NULL && iret == UUCONF_SUCCESS)
  99.     {
  100.       for (pz = pzv2; *pz != NULL; pz++)
  101.         {
  102.           iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE,
  103.                       ppzsystems, (pointer) NULL);
  104.           if (iret != UUCONF_SUCCESS)
  105.         break;
  106.         }
  107.     }
  108.  
  109.       if (pzhdb != NULL && iret == UUCONF_SUCCESS)
  110.     {
  111.       for (pz = pzhdb; *pz != NULL; pz++)
  112.         {
  113.           iret = _uuconf_iadd_string (qglobal, *pz, FALSE, TRUE,
  114.                       ppzsystems, (pointer) NULL);
  115.           if (iret != UUCONF_SUCCESS)
  116.         break;
  117.         }
  118.     }
  119.  
  120.       if (pztaylor != NULL)
  121.     free ((pointer) pztaylor);
  122.       if (pzv2 != NULL)
  123.     free ((pointer) pzv2);
  124.       if (pzhdb != NULL)
  125.     free ((pointer) pzhdb);
  126.     }
  127.  
  128.   if (iret == UUCONF_SUCCESS && *ppzsystems == NULL)
  129.     iret = _uuconf_iadd_string (qglobal, (char *) NULL, FALSE, FALSE,
  130.                 ppzsystems, (pointer) NULL);
  131.  
  132.   return iret;
  133. }
  134.